$(function(){
	/***************页面授权检查*******************/
	mb.load('encrypt');
	mb.load('sysfile','index/');
	mb.load('tools','index/');
	mb.load('pioneer','index/');
	mb.load('conero','index/');
	//$(document).tooltip();
	var auth = mb.session('m_auth');
	if(auth == 'Y'){
		$("#release_key").show();
		$("#use_key").hide();
	}else{
		$("#use_key").show();
		$("#release_key").hide();
	}
	mb.page = 'index';
	// 请求授权
	$("#use_key").click(function(){
		var key = prompt("给我您的钥匙？快插我！?");
		if(H.empty(key)) return;
		mb.item = 'keyAuth';
		var post = mb.request({'key':key});
		$.post(mb._U+'ajax',post,
			function(data){
				if(data == 'Y'){
					$("#release_key").show();
					$("#use_key").hide();
					mb.session('m_auth','Y');
				}
				//console.log(data);
		});
	});
	// 释放授权		2016/5/4 星期三
	$("#release_key").click(function(){
		mb.session('m_auth','');
		mb.item = 'keyAuth';
		var post = mb.request({'key':''});
		$.post(mb._U+'ajax',post,
			function(data){
		});
		location.reload();
	});
	/***********************导航设置******************/
	//导航注册
	mb.menu('','index_nav_items','#cro_nav_items,#pir_nav_items,#tls_nav_items,#sfl_nav_items');
	//	1.	conero 菜单
	$("#cro_nav").click(function(){
		index.tabbar($(this));
		mb.menu('#cro_nav_items','index_nav_items','','',true);
		//$("#cro_nav_items").html('$_$');
		//alert();
	});
	//	2.开拓者
	$("#pir_nav").click(function(){
		index.tabbar($(this));
		mb.menu('#pir_nav_items','index_nav_items','','',true);
	});
	//	3.工具
	$("#tls_nav").click(function(){
		index.tabbar($(this));
		mb.menu('#tls_nav_items','index_nav_items','','',true);
	});
	//	4.文件系统
	$("#sfl_nav").click(function(){
		index.tabbar($(this));
		mb.menu('#sfl_nav_items','index_nav_items','','',true);
		$("#sfl_nav_items").html();
	});
});
//学习网站~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//详情- << Back
$(document).on("click","#cro_inter_back",function(){
	var p_list = mb.session('i_lear_list');
	$("#index_content").html(p_list);
});
	//新增-
$(document).on("click","#cro_inter_add",function(){
	$("#cro_nav_items").hide();
	mb.session('i_lear_detail',$("#index_content").html());//详情二级缓存
	var xform = '<p><a href="javascript:void(0);" id="cro_inter_back"> 首页 </a> <a href="javascript:cro.back(\'#index_content\',\'i_lear_detail\');"> << Back </a></p>';//新增表单
	xform += '<form action="javascript:void(0);" method="post" id="intSave"><div class="weui_cells weui_cells_form"><div class="weui_cell"><div class="weui_cell_hd"><label class="weui_label notnull">网站名称</label></div><div class="weui_cell_bd weui_cell_primary"><input class="weui_input" type="text" placeholder="请输入网站名称" name="site"/></div></div>';
	xform += '<div class="weui_cell"><div class="weui_cell_hd"><label class="weui_label notnull">网址</label></div><div class="weui_cell_bd weui_cell_primary"><input class="weui_input" type="text" placeholder="请输入网址" name="url"/></div></div>';
	xform += '<div class="weui_cell weui_cell_select weui_select_after"> <div class="weui_cell_hd notnull">是否注册</div><div class="weui_cell_bd weui_cell_primary"><select class="weui_select" name="islogin"><option value="是">是</option><option value="否">否</option></select></div></div><div class="weui_cells_tips">是否注册选择是，“注册账号”与“用户口令”必填</div>';
	xform += '<div class="weui_cell"><div class="weui_cell_hd"><label class="weui_label">注册账号</label></div><div class="weui_cell_bd weui_cell_primary"><input class="weui_input" type="text" placeholder="请输入注册账号" name="username"/></div></div>';
	xform += '<div class="weui_cell"><div class="weui_cell_hd"><label class="weui_label">用户口令</label></div><div class="weui_cell_bd weui_cell_primary"><input class="weui_input" type="text" placeholder="请输入用户口令" name="passw"/></div></div>';
	xform += '<div class="weui_cell"><div class="weui_cell_hd"><label class="weui_label">绑定邮箱</label></div><div class="weui_cell_bd weui_cell_primary"><input class="weui_input" type="text" placeholder="请输入邮箱" name="email"/></div></div>';
	xform += '<div class="weui_cell"><div class="weui_cell_hd"><label class="weui_label">绑定手机</label></div><div class="weui_cell_bd weui_cell_primary"><input class="weui_input" type="text" placeholder="请输入手机" name="celphone"/></div></div>';
	xform += '<div class="weui_cells_title weui_label notnull">详情</div><div class="weui_cell"><div class="weui_cell_bd weui_cell_primary"><textarea class="weui_textarea" placeholder="请输入详情" rows="3" name="explan"></textarea>';
	xform += '<div class="weui_cell"><div class="weui_cell_hd"><label class="weui_label">备注</label></div><div class="weui_cell_bd weui_cell_primary"><input class="weui_input" type="text" placeholder="请输入备注" name="remark"/></div></div>';
	xform += '<a href="javascript:cro.intSave();" class="weui_btn weui_btn_disabled weui_btn_warn">确认</a></form>';
	$("#index_content").html(xform);
});
var index = 
{
	tabbar: function(dom)
	{
		if(mb.empty(dom)) return;
		$(".weui_tabbar").find(".weui_bar_item_on").removeClass("weui_bar_item_on");
		dom.addClass("weui_tabbar_item weui_bar_item_on ui-link");
	}
};